<template>
  <div>
    <HomeHeader></HomeHeader>
    <HomeSwiper :swiperList="swiperList"></HomeSwiper>
    <Icons :iconsList="iconsList"></Icons>
    <Recommend :RecList="RecList"></Recommend>
    <Weekend :weekendList="weekendList"></Weekend>
  </div>
</template>

<script>
import HomeHeader from "./components/Header";
import HomeSwiper from "./components/Swiper";
import Icons from "./components/Icons";
import Recommend from "./components/Recommend";
import Weekend from "./components//Weekend";
import axios from "axios";
export default {
  name: "Home",
  data() {
    return {
      city: "",
      swiperList: [],
      iconsList: [],
      RecList: [],
      weekendList:[]
    };
  },
  components: {
    HomeHeader,
    HomeSwiper,
    Icons,
    Recommend,
    Weekend
  },
  methods: {
    getHomeInfo() {
      axios
        .get("http://localhost:8080/api/IndexImg")
        .then(res => {
          // console.log("请求成功", res.data.datas.swiperList);
          res = res.data;
          if (res.ret && res.datas) {
            this.swiperList = res.datas.swiperList;
            this.iconsList = res.datas.iconList;
            this.RecList = res.datas.recommendList;
            this.weekendList = res.datas.weekendList;
          }
          // console.log('我是',this.swiperList);
        })
        .catch(err => {
          console.log("请求失败");
        });
      axios
        .get("http://192.168.0.104:8080/api/IndexImg")
        .then(res => {
          // console.log("请求成功", res.data.datas.swiperList);
          res = res.data;
          if (res.ret && res.datas) {
            this.swiperList = res.datas.swiperList;
            this.iconsList = res.datas.iconList;
            this.RecList = res.datas.recommendList;
            this.weekendList = res.datas.weekendList;
          }
          // console.log('我是',this.swiperList);
        })
        .catch(err => {
          console.log("请求失败");
        });
    }
  },
  mounted() {
    this.getHomeInfo();
  }
  // methods:{
  //   gethome (){
  //     axios.get('/static/mock/index.json')
  //       .then((res) => {
  //         console.log('请求成功',res.data);
  //       })
  //   }
  // },
  // mounted (){
  //   this.gethome ()
  // }
};
</script>

<style>

</style>